import { ApiTags } from '@nestjs/swagger'
import { Controller, Get, Request, Post, UseGuards } from '@nestjs/common'
import { AuthGuard } from '@nestjs/passport'
import { AuthService } from './auth/auth.service'
@Controller()
export class AppController {
  constructor(private readonly authService: AuthService) {}
  @ApiTags('登录')
  @UseGuards(AuthGuard('local'))
  @Post('auth/login')
  async login(@Request() req) {
    console.log('进来了')

    return this.authService.login(req.user)
  }
  @ApiTags('获取用户信息')
  @UseGuards(AuthGuard('jwt'))
  @Get('profile')
  getProfile(@Request() req) {
    return req.user
  }
}
